Skip to content

Add file type support for report generation#898

Merged
egibs merged 19 commits into
chainguard-dev:mainfrom
egibs:filetype-support
May 19, 2025
Merged

Add file type support for report generation#898
egibs merged 19 commits into
chainguard-dev:mainfrom
egibs:filetype-support

Conversation

@egibs
Copy link
Copy Markdown
Member

@egibs egibs commented May 1, 2025

Closes: #696
Relates to: #454

This PR finally adds filetype support for rules. To better support this, I also added filetypes to rules that seemed to be obviously referencing an OS/language/etc.

This also allows us to remove the probably rules that have to be replicated and updated separately (and they don't really work all that well anyway) -- as an aside, yara-x 0.15.0 added support for include which means that we can define global rules centrally and then reference them in the appropriate rules but that's for a future PR.

If the filetypes metadata key is present, then we only count the rule as a match if the file's extension is one of the comma-delimited strings and any number of extensions can be added to the metadata value. Finally, rules without the filetypes key are considered universal.

Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs requested a review from tstromberg May 1, 2025 16:03
egibs added 3 commits May 1, 2025 11:21
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs force-pushed the filetype-support branch from e0e4676 to d42cc8d Compare May 1, 2025 17:27
egibs added 2 commits May 1, 2025 12:34
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Comment thread pkg/action/testdata/scan_archive Outdated
Comment thread rules/anti-behavior/random_behavior.yara Outdated
Comment thread tests/linux/clean/kibana/ac96ceb8-4399-4191-af1d-4feeac1f1f46_108.json.simple Outdated
egibs added 10 commits May 19, 2025 04:47
Signed-off-by: Evan Gibler <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
@egibs egibs requested review from antitree and eslerm May 19, 2025 17:54
egibs added 3 commits May 19, 2025 15:23
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@eslerm eslerm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎 cheers

@egibs egibs merged commit e93915f into chainguard-dev:main May 19, 2025
12 checks passed
@egibs egibs deleted the filetype-support branch May 28, 2025 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider "filetype" metadata when executing rules

3 participants